{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">修改栏目</div>
    <div class="layui-card-body">
        <form class="layui-form form-horizontal" action="" method="post">
            <div class="layui-form-item">
                <label>广告名称</label>
                <div class="w300">
                    <input type="text" name="title" autocomplete="off" placeholder="广告名称" class="layui-input" value="{$data.title}">
                </div>
            </div>
            <div class="layui-form-item">
                <label>广告英文名称</label>
                <div class="w300">
                    <input type="text" name="name" autocomplete="off" placeholder="广告英文名称" class="layui-input" value="{$data.name}">
                </div>
            </div>
            <div class="layui-form-item">
                <label>广告url</label>
                <div class="w300">
                    <input type="text" name="url" autocomplete="off" placeholder="广告url 例如：http:// || https://" class="layui-input" value="{$data.url}">
                </div>
            </div>
            <div class="layui-form-item" >

                <label class="w300">背景颜色</label><br>


                <div  class="layui-inline">
                    <input type="text" name="bg_color" autocomplete="off" value="{$data.bg_color}" placeholder="背景颜色 例如：#fff" class="layui-input"  id="test-form-input">
                </div>
                <div class="layui-inline" style="left: -11px;">
                    <div id="test-form"></div>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label>pc图片</label>
                <div class="layui-form-field-label">
                    <div class="js-upload-image">
                        {php}echo \util\Form::images('thumb','',$data['thumb']){/php}
                    </div>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label>pc图片</label>
                <div class="layui-form-field-label">
                    <div class="js-upload-image">
                        {php}echo \util\Form::images('m_thumb','',$data['m_thumb']){/php}
                    </div>
                </div>
            </div>
            <div class="layui-form-item web_seo">
                <label>起止时间</label>
                <div class="w300">

                    <input type="text" name="start_time" id="start_time" autocomplete="off" placeholder="起止时间" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label>栏目id</label>
                <div class="w300">
                    <input type="text" name="cat_id" autocomplete="off" placeholder="栏目id 例如：1,2" class="layui-input" value="{$data.cat_id}">
                </div>
            </div>

            <div class="layui-form-item">
                <label>排序</label>
                <div class="w300">
                    <input type="number" name="listorder" autocomplete="off" placeholder="排序" class="layui-input" value="{$data.listorder}">
                </div>
            </div>
            <div class="layui-form-item">
                <label>状态</label>
                <div class="w300">
                    <input type="radio" name="is_show" value="1" {eq name="data.is_show" value="1" }checked{/eq} title="已通过" lay-filter="is_show">
                    <input type="radio" name="is_show" value="0" {eq name="data.is_show" value="0" }checked{/eq} title="未通过" lay-filter="is_show">
                </div>
            </div>

            <div class="layui-form-item web_seo">
                <label>网站简介</label>
                <div class="w300">
                    <textarea name="description" placeholder="网站简介" class="layui-textarea">{$data.description}</textarea>
                </div>
            </div>
            <input name="ad_id" type="hidden" value="{$data.ad_id}">
            <input name="position_id" type="hidden" value="{$data.position_id}">
            <div class="layui-form-item">
                <div>
                    <button class="layui-btn ajax-post" lay-submit lay-filter="*" target-form="form-horizontal">立即提交</button>
                    <button class="layui-btn layui-btn-normal" onclick="javascript :history.back(-1);">返回</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__STATIC__/admin/js/common.js"></script>
<script type="text/javascript" src="__STATIC__/libs/viewer/viewer.min.js"></script>
<link rel="stylesheet" href="__STATIC__/libs/viewer/viewer.min.css">
<script type="text/javascript">
$('.uploader-list').each(function () {
    $(this).viewer();
});
</script>
<script>
    layui.use(['laydate','colorpicker'], function(){
        var laydate = layui.laydate;
        var colorpicker = layui.colorpicker;

        //执行一个laydate实例
        //年范围
        laydate.render({
            elem: '#start_time'
            ,value: "{:date('Y-m-d',$data['start_time'])} - {:date('Y-m-d',$data['end_time'])}"
            ,isInitValue: true
            ,range: true
        });
        //表单赋值
        colorpicker.render({
            elem: '#test-form'
            ,color: '#1c97f5'
            ,done: function(color){
                $('#test-form-input').val(color);
            }
        });
    });

</script>
{/block}